<!DOCTYPE html>
<html lang="zh-CN" dir="ltr">
  <head>
    <meta charset="utf-8">
    
    <title>Runtime API Examples | HSX</title>
    <meta name="description" content="一起进步">
    <link rel="preload stylesheet" href="/hsx-doc/assets/style.588f4929.css" as="style">
    
    <script type="module" src="/hsx-doc/assets/app.b1539cef.js"></script>
    <link rel="preload" href="/hsx-doc/assets/inter-roman-latin.2ed14f66.woff2" as="font" type="font/woff2" crossorigin="">
    <link rel="modulepreload" href="/hsx-doc/assets/chunks/framework.4c624545.js">
    <link rel="modulepreload" href="/hsx-doc/assets/chunks/theme.03bd3968.js">
    <link rel="modulepreload" href="/hsx-doc/assets/java_java-base_api-examples.md.6c7c7c2e.lean.js">
    <link rel="icon" type="image/x-icon" href="/favicon.ico">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script id="check-dark-light">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
    <script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
  </head>
  <body>
    <div id="app"><div class="Layout" data-v-79fb0f11><!--[--><!--]--><div data-v-79fb0f11 data-v-11b28a72><span tabindex="-1" data-v-11b28a72></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-11b28a72> Skip to content </a></div><!----><header class="VPNav" data-v-79fb0f11 data-v-b672df84><div class="VPNavBar has-sidebar" data-v-b672df84 data-v-7e91ef74><div class="container" data-v-7e91ef74><div class="title" data-v-7e91ef74><div class="VPNavBarTitle has-sidebar" data-v-7e91ef74 data-v-aa11cb32><a class="title" href="/hsx-doc/" data-v-aa11cb32><!--[--><!--[--><!--[--><!--[--><div class="nav-logo"></div><!--]--><!--]--><!--]--><!--]--><!--[--><img class="VPImage logo" src="/hsx-doc/favicon.con" alt data-v-973d4afd><!--]--><!--[-->HSX<!--]--><!--[--><!--]--></a></div></div><div class="content" data-v-7e91ef74><div class="curtain" data-v-7e91ef74></div><div class="content-body" data-v-7e91ef74><!--[--><!--]--><div class="VPNavBarSearch search" data-v-7e91ef74><!----></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-7e91ef74 data-v-be5970bb><span id="main-nav-aria-label" class="visually-hidden" data-v-be5970bb>Main Navigation</span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/hsx-doc/" tabindex="0" data-v-be5970bb data-v-639ec29b><!--[--><span data-v-639ec29b>关于我</span><!--]--></a><!--]--><!--[--><div class="VPFlyout VPNavBarMenuGroup active" data-v-be5970bb data-v-a0bcce91><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-a0bcce91><span class="text" data-v-a0bcce91><!----><span data-v-a0bcce91>Java</span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="text-icon" data-v-a0bcce91><path d="M12,16c-0.3,0-0.5-0.1-0.7-0.3l-6-6c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l5.3,5.3l5.3-5.3c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-6,6C12.5,15.9,12.3,16,12,16z"></path></svg></span></button><div class="menu" data-v-a0bcce91><div class="VPMenu" data-v-a0bcce91 data-v-3ace8a97><div class="items" data-v-3ace8a97><!--[--><!--[--><div class="VPMenuLink" data-v-3ace8a97 data-v-a8a4c696><a class="VPLink link" href="/hsx-doc/java/java-base/markdown-examples" data-v-a8a4c696><!--[-->Java基础<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-3ace8a97 data-v-a8a4c696><a class="VPLink link" href="/hsx-doc/java/java-higher/markdown-examples" data-v-a8a4c696><!--[-->Java进阶<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-3ace8a97 data-v-a8a4c696><a class="VPLink link" href="/hsx-doc/java/java-senior/markdown-examples" data-v-a8a4c696><!--[-->Java高级<!--]--></a></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--]--></nav><!----><div class="VPNavBarAppearance appearance" data-v-7e91ef74 data-v-0e9077d5><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="toggle dark mode" aria-checked="false" data-v-0e9077d5 data-v-8cffb901 data-v-d8e99ed9><span class="check" data-v-d8e99ed9><span class="icon" data-v-d8e99ed9><!--[--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="sun" data-v-8cffb901><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="moon" data-v-8cffb901><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg><!--]--></span></span></button></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-7e91ef74 data-v-d47251db data-v-19ada88c><!--[--><a class="VPSocialLink no-icon" href="https://github.com/vuejs/vitepress" aria-label="github" target="_blank" rel="noopener" data-v-19ada88c data-v-fb4b93e2><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a><!--]--></div><div class="VPFlyout VPNavBarExtra extra" data-v-7e91ef74 data-v-3ef8dab4 data-v-a0bcce91><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-a0bcce91><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="icon" data-v-a0bcce91><circle cx="12" cy="12" r="2"></circle><circle cx="19" cy="12" r="2"></circle><circle cx="5" cy="12" r="2"></circle></svg></button><div class="menu" data-v-a0bcce91><div class="VPMenu" data-v-a0bcce91 data-v-3ace8a97><!----><!--[--><!--[--><!----><div class="group" data-v-3ef8dab4><div class="item appearance" data-v-3ef8dab4><p class="label" data-v-3ef8dab4>Appearance</p><div class="appearance-action" data-v-3ef8dab4><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="toggle dark mode" aria-checked="false" data-v-3ef8dab4 data-v-8cffb901 data-v-d8e99ed9><span class="check" data-v-d8e99ed9><span class="icon" data-v-d8e99ed9><!--[--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="sun" data-v-8cffb901><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="moon" data-v-8cffb901><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg><!--]--></span></span></button></div></div></div><div class="group" data-v-3ef8dab4><div class="item social-links" data-v-3ef8dab4><div class="VPSocialLinks social-links-list" data-v-3ef8dab4 data-v-19ada88c><!--[--><a class="VPSocialLink no-icon" href="https://github.com/vuejs/vitepress" aria-label="github" target="_blank" rel="noopener" data-v-19ada88c data-v-fb4b93e2><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a><!--]--></div></div></div><!--]--><!--]--></div></div></div><!--[--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-7e91ef74 data-v-e81503b4><span class="container" data-v-e81503b4><span class="top" data-v-e81503b4></span><span class="middle" data-v-e81503b4></span><span class="bottom" data-v-e81503b4></span></span></button></div></div></div></div><!----></header><div class="VPLocalNav reached-top" data-v-79fb0f11 data-v-7882286a><button class="menu" aria-expanded="false" aria-controls="VPSidebarNav" data-v-7882286a><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="menu-icon" data-v-7882286a><path d="M17,11H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,11,17,11z"></path><path d="M21,7H3C2.4,7,2,6.6,2,6s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,7,21,7z"></path><path d="M21,15H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,15,21,15z"></path><path d="M17,19H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,19,17,19z"></path></svg><span class="menu-text" data-v-7882286a>Menu</span></button><div class="VPLocalNavOutlineDropdown" style="--vp-vh:0px;" data-v-7882286a data-v-f6996b97><button data-v-f6996b97>Return to top</button><!----></div></div><aside class="VPSidebar" inert data-v-79fb0f11 data-v-83297f14><div class="curtain" data-v-83297f14></div><nav class="nav" id="VPSidebarNav" aria-labelledby="sidebar-aria-label" tabindex="-1" data-v-83297f14><span class="visually-hidden" id="sidebar-aria-label" data-v-83297f14> Sidebar Navigation </span><!--[--><!--]--><!--[--><div class="group" data-v-83297f14><section class="VPSidebarItem level-0 collapsible has-active" data-v-83297f14 data-v-a5542fb4><div class="item" role="button" tabindex="0" data-v-a5542fb4><div class="indicator" data-v-a5542fb4></div><h2 class="text" data-v-a5542fb4>java-base</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-a5542fb4><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-a5542fb4><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-a5542fb4><!--[--><div class="VPSidebarItem level-1 is-link" data-v-a5542fb4 data-v-a5542fb4><div class="item" data-v-a5542fb4><div class="indicator" data-v-a5542fb4></div><a class="VPLink link link" href="/hsx-doc/java/java-base/markdown-examples" data-v-a5542fb4><!--[--><p class="text" data-v-a5542fb4>Markdown java-base</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-a5542fb4 data-v-a5542fb4><div class="item" data-v-a5542fb4><div class="indicator" data-v-a5542fb4></div><a class="VPLink link link" href="/hsx-doc/java/java-base/api-examples" data-v-a5542fb4><!--[--><p class="text" data-v-a5542fb4>Runtime API java-base</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-83297f14><section class="VPSidebarItem level-0 collapsible collapsed" data-v-83297f14 data-v-a5542fb4><div class="item" role="button" tabindex="0" data-v-a5542fb4><div class="indicator" data-v-a5542fb4></div><h2 class="text" data-v-a5542fb4>java-higher</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-a5542fb4><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-a5542fb4><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-a5542fb4><!--[--><div class="VPSidebarItem level-1 is-link" data-v-a5542fb4 data-v-a5542fb4><div class="item" data-v-a5542fb4><div class="indicator" data-v-a5542fb4></div><a class="VPLink link link" href="/hsx-doc/java/java-higher/markdown-examples" data-v-a5542fb4><!--[--><p class="text" data-v-a5542fb4>Markdown java-higher</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-a5542fb4 data-v-a5542fb4><div class="item" data-v-a5542fb4><div class="indicator" data-v-a5542fb4></div><a class="VPLink link link" href="/hsx-doc/java/java-higher/api-examples" data-v-a5542fb4><!--[--><p class="text" data-v-a5542fb4>Runtime API java-higher</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-83297f14><section class="VPSidebarItem level-0 collapsible collapsed" data-v-83297f14 data-v-a5542fb4><div class="item" role="button" tabindex="0" data-v-a5542fb4><div class="indicator" data-v-a5542fb4></div><h2 class="text" data-v-a5542fb4>java-senior</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-a5542fb4><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-a5542fb4><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-a5542fb4><!--[--><div class="VPSidebarItem level-1 is-link" data-v-a5542fb4 data-v-a5542fb4><div class="item" data-v-a5542fb4><div class="indicator" data-v-a5542fb4></div><a class="VPLink link link" href="/hsx-doc/java/java-senior/markdown-examples" data-v-a5542fb4><!--[--><p class="text" data-v-a5542fb4>Markdown java-senior</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-a5542fb4 data-v-a5542fb4><div class="item" data-v-a5542fb4><div class="indicator" data-v-a5542fb4></div><a class="VPLink link link" href="/hsx-doc/java/java-senior/api-examples" data-v-a5542fb4><!--[--><p class="text" data-v-a5542fb4>Runtime API java-senior</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><!--]--><!--[--><!--]--></nav></aside><div class="VPContent has-sidebar" id="VPContent" data-v-79fb0f11 data-v-03b12d72><div class="VPDoc has-sidebar has-aside" data-v-03b12d72 data-v-e4e03cac><!--[--><!--]--><div class="container" data-v-e4e03cac><div class="aside" data-v-e4e03cac><div class="aside-curtain" data-v-e4e03cac></div><div class="aside-container" data-v-e4e03cac><div class="aside-content" data-v-e4e03cac><div class="VPDocAside" data-v-e4e03cac data-v-44f3fea8><!--[--><!--]--><!--[--><!--]--><div class="VPDocAsideOutline" role="navigation" data-v-44f3fea8 data-v-42a3be47><div class="content" data-v-42a3be47><div class="outline-marker" data-v-42a3be47></div><div class="outline-title" role="heading" aria-level="2" data-v-42a3be47>当前目录</div><nav aria-labelledby="doc-outline-aria-label" data-v-42a3be47><span class="visually-hidden" id="doc-outline-aria-label" data-v-42a3be47> Table of Contents for current page </span><ul class="root" data-v-42a3be47 data-v-21daf4a7><!--[--><!--]--></ul></nav></div></div><!--[--><!--]--><div class="spacer" data-v-44f3fea8></div><!--[--><!--]--><!----><!--[--><!--]--><!--[--><!--]--></div></div></div></div><div class="content" data-v-e4e03cac><div class="content-container" data-v-e4e03cac><!--[--><!--]--><!----><main class="main" data-v-e4e03cac><div style="position:relative;" class="vp-doc _hsx-doc_java_java-base_api-examples" data-v-e4e03cac><div><h1 id="runtime-api-examples" tabindex="-1">Runtime API Examples <a class="header-anchor" href="#runtime-api-examples" aria-label="Permalink to &quot;Runtime API Examples&quot;">​</a></h1><p>This page demonstrates usage of some of the runtime APIs provided by VitePress.</p><p>The main <code>useData()</code> API can be used to access site, theme, and page data for the current page. It works in both <code>.md</code> and <code>.vue</code> files:</p><div class="language-md vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">md</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">&lt;script setup&gt;</span></span>
<span class="line"><span style="color:#E1E4E8;">import { useData } from &#39;vitepress&#39;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">const { theme, page, frontmatter } = useData()</span></span>
<span class="line"><span style="color:#E1E4E8;">&lt;/script&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#79B8FF;font-weight:bold;">## Results</span></span>
<span class="line"></span>
<span class="line"><span style="color:#79B8FF;font-weight:bold;">### Theme Data</span></span>
<span class="line"><span style="color:#E1E4E8;">&lt;pre&gt;{{ theme }}&lt;/pre&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#79B8FF;font-weight:bold;">### Page Data</span></span>
<span class="line"><span style="color:#E1E4E8;">&lt;pre&gt;{{ page }}&lt;/pre&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#79B8FF;font-weight:bold;">### Page Frontmatter</span></span>
<span class="line"><span style="color:#E1E4E8;">&lt;pre&gt;{{ frontmatter }}&lt;/pre&gt;</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">&lt;script setup&gt;</span></span>
<span class="line"><span style="color:#24292E;">import { useData } from &#39;vitepress&#39;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">const { theme, page, frontmatter } = useData()</span></span>
<span class="line"><span style="color:#24292E;">&lt;/script&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#005CC5;font-weight:bold;">## Results</span></span>
<span class="line"></span>
<span class="line"><span style="color:#005CC5;font-weight:bold;">### Theme Data</span></span>
<span class="line"><span style="color:#24292E;">&lt;pre&gt;{{ theme }}&lt;/pre&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#005CC5;font-weight:bold;">### Page Data</span></span>
<span class="line"><span style="color:#24292E;">&lt;pre&gt;{{ page }}&lt;/pre&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#005CC5;font-weight:bold;">### Page Frontmatter</span></span>
<span class="line"><span style="color:#24292E;">&lt;pre&gt;{{ frontmatter }}&lt;/pre&gt;</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br></div></div><h2 id="results" tabindex="-1">Results <a class="header-anchor" href="#results" aria-label="Permalink to &quot;Results&quot;">​</a></h2><h3 id="theme-data" tabindex="-1">Theme Data <a class="header-anchor" href="#theme-data" aria-label="Permalink to &quot;Theme Data&quot;">​</a></h3><pre>{
  &quot;logo&quot;: &quot;/favicon.con&quot;,
  &quot;outline&quot;: &quot;deep&quot;,
  &quot;outlineTitle&quot;: &quot;当前目录&quot;,
  &quot;nav&quot;: [
    {
      &quot;text&quot;: &quot;关于我&quot;,
      &quot;link&quot;: &quot;/&quot;
    },
    {
      &quot;text&quot;: &quot;Java&quot;,
      &quot;activeMatch&quot;: &quot;/java/&quot;,
      &quot;items&quot;: [
        {
          &quot;text&quot;: &quot;Java基础&quot;,
          &quot;link&quot;: &quot;/java/java-base/markdown-examples&quot;
        },
        {
          &quot;text&quot;: &quot;Java进阶&quot;,
          &quot;link&quot;: &quot;/java/java-higher/markdown-examples&quot;
        },
        {
          &quot;text&quot;: &quot;Java高级&quot;,
          &quot;link&quot;: &quot;/java/java-senior/markdown-examples&quot;
        }
      ]
    }
  ],
  &quot;docFooter&quot;: {
    &quot;prev&quot;: &quot;上一篇&quot;,
    &quot;next&quot;: &quot;下一篇&quot;
  },
  &quot;lastUpdatedText&quot;: &quot;最近更新时间&quot;,
  &quot;footer&quot;: {
    &quot;message&quot;: &quot;为未来不一样的你喝彩！&quot;,
    &quot;copyright&quot;: &quot;&lt;a target=\&quot;_blank\&quot; href=\&quot;\&quot;&gt;MIT License HSX &lt;/a&gt; | 版权所有 © 2022-2023&quot;
  },
  &quot;sidebar&quot;: [
    {
      &quot;text&quot;: &quot;java-base&quot;,
      &quot;collapsed&quot;: true,
      &quot;items&quot;: [
        {
          &quot;text&quot;: &quot;Markdown java-base&quot;,
          &quot;link&quot;: &quot;/java/java-base/markdown-examples&quot;
        },
        {
          &quot;text&quot;: &quot;Runtime API java-base&quot;,
          &quot;link&quot;: &quot;/java/java-base/api-examples&quot;
        }
      ]
    },
    {
      &quot;text&quot;: &quot;java-higher&quot;,
      &quot;collapsed&quot;: true,
      &quot;items&quot;: [
        {
          &quot;text&quot;: &quot;Markdown java-higher&quot;,
          &quot;link&quot;: &quot;/java/java-higher/markdown-examples&quot;
        },
        {
          &quot;text&quot;: &quot;Runtime API java-higher&quot;,
          &quot;link&quot;: &quot;/java/java-higher/api-examples&quot;
        }
      ]
    },
    {
      &quot;text&quot;: &quot;java-senior&quot;,
      &quot;collapsed&quot;: true,
      &quot;items&quot;: [
        {
          &quot;text&quot;: &quot;Markdown java-senior&quot;,
          &quot;link&quot;: &quot;/java/java-senior/markdown-examples&quot;
        },
        {
          &quot;text&quot;: &quot;Runtime API java-senior&quot;,
          &quot;link&quot;: &quot;/java/java-senior/api-examples&quot;
        }
      ]
    }
  ],
  &quot;socialLinks&quot;: [
    {
      &quot;icon&quot;: &quot;github&quot;,
      &quot;link&quot;: &quot;https://github.com/vuejs/vitepress&quot;
    }
  ]
}</pre><h3 id="page-data" tabindex="-1">Page Data <a class="header-anchor" href="#page-data" aria-label="Permalink to &quot;Page Data&quot;">​</a></h3><pre>{
  &quot;title&quot;: &quot;Runtime API Examples&quot;,
  &quot;description&quot;: &quot;&quot;,
  &quot;frontmatter&quot;: {
    &quot;outline&quot;: &quot;deep&quot;
  },
  &quot;headers&quot;: [],
  &quot;relativePath&quot;: &quot;java/java-base/api-examples.md&quot;,
  &quot;filePath&quot;: &quot;java/java-base/api-examples.md&quot;
}</pre><h3 id="page-frontmatter" tabindex="-1">Page Frontmatter <a class="header-anchor" href="#page-frontmatter" aria-label="Permalink to &quot;Page Frontmatter&quot;">​</a></h3><pre>{
  &quot;outline&quot;: &quot;deep&quot;
}</pre><h2 id="more" tabindex="-1">More <a class="header-anchor" href="#more" aria-label="Permalink to &quot;More&quot;">​</a></h2><p>Check out the documentation for the <a href="https://vitepress.dev/reference/runtime-api#usedata" target="_blank" rel="noreferrer">full list of runtime APIs</a>.</p></div></div></main><footer class="VPDocFooter" data-v-e4e03cac data-v-eea887c5><!--[--><!--]--><!----><nav class="prev-next" data-v-eea887c5><div class="pager" data-v-eea887c5><a class="pager-link prev" href="/hsx-doc/java/java-base/markdown-examples" data-v-eea887c5><span class="desc" data-v-eea887c5>上一篇</span><span class="title" data-v-eea887c5>Markdown java-base</span></a></div><div class="pager" data-v-eea887c5><a class="pager-link next" href="/hsx-doc/java/java-higher/markdown-examples" data-v-eea887c5><span class="desc" data-v-eea887c5>下一篇</span><span class="title" data-v-eea887c5>Markdown java-higher</span></a></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><footer class="VPFooter has-sidebar" data-v-79fb0f11 data-v-d21fd272><div class="container" data-v-d21fd272><p class="message" data-v-d21fd272>为未来不一样的你喝彩！</p><p class="copyright" data-v-d21fd272><a target="_blank" href="">MIT License HSX </a> | 版权所有 © 2022-2023</p></div></footer><!--[--><!--]--></div></div>
    <script>window.__VP_HASH_MAP__=JSON.parse("{\"java_java-base_api-examples.md\":\"6c7c7c2e\",\"java_java-base_markdown-examples.md\":\"75f9a348\",\"java_java-higher_markdown-examples.md\":\"51380741\",\"java_java-senior_api-examples.md\":\"be0529a9\",\"java_java-higher_api-examples.md\":\"7546d63c\",\"index.md\":\"a2696fe5\",\"java_java-senior_markdown-examples.md\":\"5fe1193b\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"zh-CN\",\"dir\":\"ltr\",\"title\":\"HSX\",\"description\":\"一起进步\",\"base\":\"/hsx-doc/\",\"head\":[],\"appearance\":true,\"themeConfig\":{\"logo\":\"/favicon.con\",\"outline\":\"deep\",\"outlineTitle\":\"当前目录\",\"nav\":[{\"text\":\"关于我\",\"link\":\"/\"},{\"text\":\"Java\",\"activeMatch\":\"/java/\",\"items\":[{\"text\":\"Java基础\",\"link\":\"/java/java-base/markdown-examples\"},{\"text\":\"Java进阶\",\"link\":\"/java/java-higher/markdown-examples\"},{\"text\":\"Java高级\",\"link\":\"/java/java-senior/markdown-examples\"}]}],\"docFooter\":{\"prev\":\"上一篇\",\"next\":\"下一篇\"},\"lastUpdatedText\":\"最近更新时间\",\"footer\":{\"message\":\"为未来不一样的你喝彩！\",\"copyright\":\"<a target=\\\"_blank\\\" href=\\\"\\\">MIT License HSX </a> | 版权所有 © 2022-2023\"},\"sidebar\":[{\"text\":\"java-base\",\"collapsed\":true,\"items\":[{\"text\":\"Markdown java-base\",\"link\":\"/java/java-base/markdown-examples\"},{\"text\":\"Runtime API java-base\",\"link\":\"/java/java-base/api-examples\"}]},{\"text\":\"java-higher\",\"collapsed\":true,\"items\":[{\"text\":\"Markdown java-higher\",\"link\":\"/java/java-higher/markdown-examples\"},{\"text\":\"Runtime API java-higher\",\"link\":\"/java/java-higher/api-examples\"}]},{\"text\":\"java-senior\",\"collapsed\":true,\"items\":[{\"text\":\"Markdown java-senior\",\"link\":\"/java/java-senior/markdown-examples\"},{\"text\":\"Runtime API java-senior\",\"link\":\"/java/java-senior/api-examples\"}]}],\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/vuejs/vitepress\"}]},\"locales\":{},\"scrollOffset\":90,\"cleanUrls\":true}");</script>
    
  </body>
</html>